package com.github.tetrisgame.utils;

import android.view.View;

import androidx.appcompat.app.AlertDialog;
import androidx.viewbinding.ViewBinding;

import com.google.android.material.bottomsheet.BottomSheetDialog;

/*
   弹出一个提示框
   1. 外部传入一个自定义的View/ViewBinding/layout_id
   2. 外部自己选择是否需要添加事件（）
 */
public abstract class AlertDialogUtil<T extends ViewBinding> {
    private T mBinding;
    private BottomSheetDialog mDialog;

    public AlertDialogUtil(T binding){
        this.mBinding = binding;

        //创建自定义的提示框
        mDialog = new BottomSheetDialog(mBinding.getRoot().getContext());
        mDialog.setContentView(mBinding.getRoot());

        initEvent(this.mBinding);
    }

    public void initEvent(T binding){

    }

    public void show(){
        mDialog.show();
    }

    public void dismiss(){
        mDialog.dismiss();
    }
}
